package com.sigleton.mode;

/**
 * test
 */
public class TestMain {
    /**
     * 多执行几次可看出效果
     *
     * @param args
     */
    public static void main(String[] args) {
        Thread[] threads = new Thread[10];
        for (int i = 0; i < threads.length; i++) {
            threads[i] = new TestThread();
        }
        for (int i = 0; i < threads.length; i++) {
            threads[i].start();
        }
    }
}

class TestThread extends Thread {
    @Override
    public void run() {
        // 对于不同单例模式的实现，只需更改相应的单例类名及其公有静态工厂方法名即可
        //int hash = SlackerModelEntity.getSlackerModelEntity().hashCode();
        //System.out.println(hash);
        int hash2 = SlackerModelThreadEntity.StarvingModelThreadEntity().hashCode();
        System.out.println(hash2);
        //int hash3 = StarvingModelEntity.getStarvingModelEntity().hashCode();
        //System.out.println(hash3);

    }
}
